package com.zw.a.basic.a07.demo13_tostring;

public class Student {
    private String name;
    private int age;
    private String sex;
    private String email;

    public Student() {
    }

    public Student(String name, int age, String sex, String email) {
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    //自定义一个方法, show(), 用来获取所有的成员变量值.
    public String show() {
        return name + "..." + age + "..." + sex + "..." + email;
    }


    //重写Object类的toString()方法, 用来打印该对象的各个属性值.
    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex='" + sex + '\'' +
                ", email='" + email + '\'' +
                '}';
    }
}
